//
//  Crytek Engine Source File.
//  Copyright (C), Crytek Studios, 2002.
// -------------------------------------------------------------------------
//  File name:   cvars.cpp
//  Version:     v1.00
//  Created:     28/5/2001 by Vladimir Kajalin
//  Compilers:   Visual Studio.NET
//  Description: console variables used in 3dengine
// -------------------------------------------------------------------------
//  History:
//
////////////////////////////////////////////////////////////////////////////

#include "StdAfx.h"

#include "3dEngine.h"
#include "IRenderer.h"

//////////////////////////////////////////////////////////////////////////
void OnTimeOfDayVarChange( ICVar *pArgs )
{
  gEnv->p3DEngine->GetTimeOfDay()->SetTime( Cry3DEngineBase::GetCVars()->e_TimeOfDay );
}


void OnTimeOfDaySpeedVarChange( ICVar *pArgs )
{
  ITimeOfDay::SAdvancedInfo advInfo;
  gEnv->p3DEngine->GetTimeOfDay()->GetAdvancedInfo(advInfo);
  advInfo.fAnimSpeed = Cry3DEngineBase::GetCVars()->e_TimeOfDaySpeed;
  gEnv->p3DEngine->GetTimeOfDay()->SetAdvancedInfo(advInfo);
}

void CVars::Init()
{
  DefineConstIntCVar(e_Fog, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates global height/distance based fog");
  DefineConstIntCVar(e_FogVolumes, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates local height/distance based fog volumes");
  REGISTER_CVAR(e_Entities, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of entities and brushes");
  DefineConstIntCVar(e_SkyBox, 1, VF_CHEAT, 
    "Activates drawing of skybox and moving cloud layers");
  REGISTER_CVAR(e_WaterOcean, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of ocean. \n"
	"1: use fast rendering path with merged fog (default)\n"
    "2: use usual rendering path");		
  DefineConstIntCVar(e_WaterOceanBottom, 1, VF_CHEAT, 
		"Activates drawing bottom of ocean");
  
  REGISTER_CVAR(e_WaterOceanFFT, 0, VF_NULL, 
    "Activates fft based ocean");

  DefineConstIntCVar(e_DebugDrawShowOnlyCompound, 0, VF_NULL, 
    "e_DebugDraw shows only Compound (less efficient) static meshes");
  DefineConstIntCVar(e_DebugDrawShowOnlyLod, -1, VF_NULL, 
    "e_DebugDraw shows only objects showing lod X");

  DefineConstIntCVar(e_DebugDraw, 0, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK,
    "Draw helpers with information for each object (same number negative hides the text)\n"
    " 1: Name of the used cgf, polycount, used LOD\n"
    " 2: Color coded polygon count\n"
    " 3: Show color coded LODs count, flashing color indicates no Lod\n"
    " 4: Display object texture memory usage\n"
    " 5: Display color coded number of render materials\n"
    " 6: Display ambient color\n"
    " 7: Display tri count, number of render materials, texture memory\n"
    " 8: RenderWorld statistics (with view cones)\n"
    " 9: RenderWorld statistics (with view cones without lights)\n"
    "10: Render geometry with simple lines and triangles\n"
    "11: Render occlusion geometry additionally\n"
    "12: Render occlusion geometry without render geometry\n"
    "13: Display occlusion amount (used during AO computations)\n"
    "15: Display helpers\n"
    "16: Display debug gun\n"
    "17: Streaming info (buffer sizes)\n"
    "18: Streaming info (required streaming speed)\n"
    "19: Physics proxy triangle count\n"
    "20: Display object instant texture memory usage\n"
    "21: Display object distance to camera\n"
    "22: Display object's current LOD vertex count\n"	);

  REGISTER_CVAR(e_TerrainDetailMaterials, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of detail materials on terrain ground");
  DefineConstIntCVar(e_TerrainDetailMaterialsDebug, 0, VF_CHEAT,
    "Shows number of materials in use per terrain sector");
  DefineConstFloatCVar(e_TerrainDetailMaterialsViewDistZ, VF_NULL, 
    "Max view distance of terrain Z materials");
	DefineConstFloatCVar(e_TerrainDetailMaterialsZAngle, VF_NULL, 
		"Max slop angle for the terrain detail Z-axe material");
  DefineConstFloatCVar(e_TerrainDetailMaterialsViewDistXY, VF_NULL, 
    "Max view distance of terrain XY materials");
  DefineConstFloatCVar(e_SunClipPlaneRange, VF_NULL, 
    "Maximum possible clip plane range for sun light frustum in meters");
  DefineConstFloatCVar(e_SunAngleSnapSec, VF_NULL, 
    "Sun dir snap control");
  DefineConstFloatCVar(e_SunAngleSnapDot, VF_NULL, 
    "Sun dir snap control");

  REGISTER_CVAR(e_Particles, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of particles");
  DefineConstIntCVar(e_ParticlesDebug, 0, VF_CHEAT | VF_BITFIELD, 
    "Particle debug flags: flags+ enables, flags- disables\n"
    " 1 = show basic stats\n"
    " m = show memory usage\n"
    " r = show reiteration, rejection, and collision stats\n"
    " b = draw bounding boxes and labels, show bounding box stats\n"
    " x = show bounding box stats\n"
    " s = log emitter and particle counts by effect (for 1 frame)\n"
    // " e = log particle system timing info (for 1 frame)\n"
    " c = disable clipping against water and vis area bounds\n"
		" d = force dynamic bounds and update for all emitters"
		" k = disable freeing of unseen emitters"
    " z = freeze particle system");
  REGISTER_CVAR(e_ParticlesThread, 1, VF_BITFIELD, 
    "Enable particle threading");




  REGISTER_CVAR(e_ParticlesObjectCollisions, 1, VF_NULL, 
    "Enable particle/object collisions for SimpleCollision:\n"
    "  1 = against static objects only, 2 = dynamic also");
  REGISTER_CVAR(e_ParticlesPreload, 1, VF_NULL, 
    "Enable preloading of all particle effects at the beginning");
  REGISTER_CVAR(e_ParticlesLod, 1, VF_NULL, 
    "Multiplier to particle count");
	REGISTER_CVAR(e_ParticlesMinDrawAlpha, 0.004f, VF_NULL, 
    "Alpha cutoff for rendering particles");
  REGISTER_CVAR(e_ParticlesMinDrawPixels, 1, VF_NULL, 
    "Pixel size min per particle -- fade out earlier");
  REGISTER_CVAR(e_ParticlesMaxDrawScreen, 2, VF_NULL, 
    "Screen size max per particle -- fade out earlier");
  REGISTER_CVAR(e_ParticlesMaxScreenFill, 64, VF_NULL, 
    "Screen size max of total particles to draw");
	DefineConstIntCVar(e_ParticlesCullAgainstViewFrustum, 0, VF_CHEAT, 
		"Cull particles against the view frustum");

  DefineConstIntCVar(e_ParticlesDumpMemoryAfterMapLoad, 0, VF_NULL, 
    "Set to 1 to dump particle memory informations after map load");

  DefineConstIntCVar(e_Roads, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of road objects");

  REGISTER_CVAR(e_Decals, 1, VF_NULL | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of decals (game decals and hand-placed)");
  REGISTER_CVAR(e_DecalsForceDeferred, 0, VF_NULL, 
    "1 - force to convert all decals to use deferred ones");
  REGISTER_CVAR(e_DecalsDefferedStatic, 1, VF_NULL, 
    "1 - switch all non-planar decals placed by level designer to deferred");
  REGISTER_CVAR(e_DecalsDefferedDynamic, 1, VF_NULL, 
    "1 - make all game play decals deferred, 2 - make all game play decals non deferred");
  DefineConstFloatCVar(e_DecalsDefferedDynamicMinSize, VF_CHEAT, 
    "Convert only dynamic decals bigger than X into deferred");
  DefineConstFloatCVar(e_DecalsDefferedDynamicDepthScale, VF_CHEAT, 
    "Scale decal projection depth");
  DefineConstFloatCVar(e_DecalsPlacementTestAreaSize, VF_CHEAT, 
    "Avoid spawning decals on the corners or edges of entity geometry");
  REGISTER_CVAR(e_DecalsMaxTrisInObject, 8000, VF_NULL, 
    "Do not create decals on objects having more than X triangles");
  REGISTER_CVAR(e_DecalsAllowGameDecals,	1, VF_NULL, 
    "Allows creation of decals by game (like weapon bullets marks)");
  DefineConstIntCVar(e_DecalsHitCache, 1, VF_CHEAT, 
    "Use smart hit caching for bullet hits (may cause no decals in some cases)");
  DefineConstIntCVar(e_DecalsMerge, 0, VF_NULL, 
    "Combine pieces of decals into one render call");
  DefineConstIntCVar(e_DecalsPreCreate, 1, VF_NULL, 
    "Pre-create decals at load time");
  DefineConstIntCVar(e_DecalsScissor, 1, VF_NULL,
    "Enable decal rendering optimization by using scissor");
  DefineConstIntCVar(e_DecalsClip, 1, VF_NULL, 
    "Clip decal geometry by decal bbox");
  DefineConstFloatCVar(e_DecalsRange, VF_NULL, 
    "Less precision for decals outside this range");
  REGISTER_CVAR(e_DecalsLifeTimeScale, 1.f, VF_NULL, 
    "Allows to increase or reduce decals life time for different specs");
  REGISTER_CVAR(e_DecalsNeighborMaxLifeTime, 4.f, VF_NULL, 
    "If not zero - new decals will force old decals to fade in X seconds");
  REGISTER_CVAR(e_DecalsOverlapping, 0, VF_NULL, 
    "If zero - new decals will not be spawned if the distance to nearest decals less than X");
  DefineConstIntCVar(e_DecalsMaxValidFrames, 600, VF_NULL, 
    "Number of frames after which not visible static decals are removed");
  REGISTER_CVAR(e_DecalsMaxUpdatesPerFrame, 4, VF_NULL, 
    "Maximum number of static decal render mesh updates per frame");
  DefineConstIntCVar(e_VegetationBending, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VegetationAlphaBlend, 1, VF_CHEAT, 
    "Allow alpha blending for vegetations");
  REGISTER_CVAR(e_VegetationUseTerrainColor, 1, VF_NULL, 
    "Allow blend with terrain color for vegetations");
  DefineConstIntCVar(e_VegetationSphericalSkinning,	1, VF_CHEAT, 
    "Activates vegetation spherical skinning support");  
  REGISTER_CVAR(e_Vegetation, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of distributed objects like trees");
	REGISTER_CVAR(e_VegetationProfiler, 0, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
		"Show the ingame vegetation profiler");
  REGISTER_CVAR(e_VegetationSprites, 1, VF_NULL, 
    "Activates drawing of sprites instead of distributed objects at far distance");
	REGISTER_CVAR(e_DissolveSpriteMinDist, 4.f, VF_NULL, 
		"The min dist over which vegetation sprites dissolve");
	REGISTER_CVAR(e_DissolveSpriteDistRatio, 0.1f, VF_NULL, 
		"The fraction of vegetation sprite draw distance over which to dissolve");
	DefineConstIntCVar(e_VegetationSpritesBatching, 1, VF_NULL, 
    "Activates batch processing for sprites, optimizes CPU usage in case of dense vegetation");
  DefineConstIntCVar(e_VegetationBoneInfo, 0, VF_CHEAT, 
    "Logs information about number of bones in each vegetation object loaded");
  REGISTER_CVAR(e_VegetationAlignToTerrainAmount, 1.f, VF_CHEAT, 
    "0 - no align, 1 - full align");
  REGISTER_CVAR(e_VegetationSpritesMinDistance, 8.0f, VF_NULL, 
    "Sets minimal distance when distributed object can be replaced with sprite");

  REGISTER_CVAR(e_VegetationSpritesDistanceRatio, 1.0f, VF_NULL, 
    "Allows changing distance on what vegetation switch into sprite");
  REGISTER_CVAR(e_VegetationSpritesDistanceCustomRatioMin, 1.0f, VF_NULL, 
    "Clamps SpriteDistRatio setting in vegetation properties");
  DefineConstIntCVar(e_ForceDetailLevelForScreenRes, 0, VF_NULL, 
    "Force sprite distance and other values used for some specific screen resolution, 0 means current");
  REGISTER_CVAR(e_VegetationMinSize,0.f,VF_REQUIRE_LEVEL_RELOAD,
    "Minimal size of static object, smaller objects will be not rendered");

	DefineConstFloatCVar(e_VegetationSpritesScaleFactor, VF_NULL,
		"[0-1] amount to factor in scale of sprites in sprite switch distance.");

  DefineConstIntCVar(e_Wind, 1, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_WindAreas, 1, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_Shadows, 1, VF_NULL, 
    "Activates drawing of shadows");
  DefineConstIntCVar(e_ShadowsLodBiasFixed, 1, VF_NULL, 
    "Simplifies mesh for shadow map generation by X LOD levels");
  DefineConstIntCVar(e_ShadowsLodBiasInvis, 0, VF_NULL, 
    "Simplifies mesh for shadow map generation by X LOD levels, if object is not visible in main frame");

	DefineConstIntCVar(e_Tessellation, 1, VF_NULL, 
		"HW geometry tessellation  0 = not allowed, 1 = allowed");
	REGISTER_CVAR(e_TessellationMaxDistance, 30.f, VF_NULL,
		"Maximum distance from camera in meters to allow tessellation, also affects distance-based displacement fadeout");
	DefineConstIntCVar(e_ShadowsTessellateCascades, 1, VF_NULL, 
		"Maximum cascade number to render tessellated shadows (0 = no tessellation for sun shadows)");
	DefineConstIntCVar(e_ShadowsTessellateDLights, 0, VF_NULL, 
		"Disable/enable tessellation for local lights shadows");
  DefineConstIntCVar(e_GsmExtendLastLodIncludeObjects, 0, VF_NULL, 
    "Includes object shadows into last very big shadow frustum");
  REGISTER_CVAR(e_GsmExtendLastLod, e_GsmExtendLastLodDefault, VF_NULL, 
    "Make last cascade bigger and use less frequent updates");
  REGISTER_CVAR(e_GsmCastFromTerrain, e_GsmCastFromTerrainDefault, VF_NULL, 
    "Cast shadows from terrain");
  DefineConstIntCVar(e_GsmExtendLastLodUseVariance, 0, VF_NULL,
    "Enable Variance Shadow mapping on shadows from terrain");
  DefineConstIntCVar(e_GsmExtendLastLodUseAdditiveBlending, 0, VF_NULL,
    "Enable Additive Blending on shadows from terrain");  
  REGISTER_CVAR(e_ShadowsOnAlphaBlend, 0, VF_NULL, 
    "Enable shadows on alphablended ");
  DefineConstIntCVar(e_ShadowsFrustums, 0, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_ShadowsDebug, 0, VF_CHEAT, 
    "0=off, 2=visualize shadow maps on the screen");
  REGISTER_CVAR(e_ShadowsClouds, 1, VF_NULL, 
    "Cloud shadows");	// no cheat var because this feature shouldn't be strong enough to affect gameplay a lot
  REGISTER_CVAR(e_ShadowsMaxTexRes,1024, VF_NULL, 
    "Set maximum resolution of shadow map\n256(faster), 512(medium), 1024(better quality)");
  REGISTER_CVAR(e_ShadowsResScale, 2.8f, VF_NULL, 
    "Shadows slope bias for shadowgen");
  REGISTER_CVAR(e_ShadowsAdaptScale, 2.72f, VF_NULL, 
    "Shadows slope bias for shadowgen");
  REGISTER_CVAR(e_ShadowsSlopeBias, 1.0, VF_NULL, 
    "Shadows slope bias for shadowgen");
	REGISTER_CVAR(e_ShadowsSlopeBiasHQ, 0.25f, VF_NULL, 
		"Shadows slope bias for shadowgen (for high quality mode)");
  REGISTER_CVAR(e_ShadowsConstBias, 1.0, VF_NULL, 
    "Shadows slope bias for shadowgen");
	REGISTER_CVAR(e_ShadowsConstBiasHQ, 0.05f, VF_NULL, 
		"Shadows slope bias for shadowgen (high quality mode)");
  DefineConstIntCVar(e_ShadowsOnWater, 0, VF_NULL, 
    "Enable/disable shadows on water");

  DefineConstIntCVar(e_ShadowsMasksLimit, 0, VF_NULL,
    "Maximum amount of allocated shadow mask textures\n"
    "This limits the number of shadow casting lights overlapping\n"
    "0=disable limit(unpredictable memory requirements)\n"
    "1=one texture (4 channels for 4 lights)\n"
    "2=two textures (8 channels for 8 lights), ...");

	REGISTER_CVAR(e_ShadowsUpdateViewDistRatio, 128 , VF_NULL, 
		"View dist ratio for shadow maps updating for shadowpool");
  DefineConstFloatCVar(e_ShadowsCastViewDistRatioLights, VF_NULL, 
    "View dist ratio for shadow maps casting for light sources");
  REGISTER_CVAR(e_ShadowsCastViewDistRatio, 0.8f, VF_NULL, 
    "View dist ratio for shadow maps casting from objects");
  REGISTER_CVAR(e_ShadowsOcclusionCulling, 0, VF_NULL, 
    "Enable/disable shadow-caster test against the occlusion buffer");
  DefineConstIntCVar(e_ShadowsOcclusionCullingCaster, 0, VF_NULL, 
    "Clips the caster extrusion to the zero height.");
  REGISTER_CVAR(e_ShadowsCharacterExtend, 0.0f, VF_NULL,
    "Extension to character bounds when rendering into GSM shadows\n");
  REGISTER_CVAR(e_GsmRange, 3.0f, VF_NULL, 
    "Size of LOD 0 GSM area (in meters)");
  REGISTER_CVAR(e_GsmRangeStep, 3.0f, VF_NULL, 
    "Range of next GSM lod is previous range multiplied by step");
  REGISTER_CVAR(e_GsmLodsNum, 5, VF_NULL, 
    "Number of GSM lods (0..5)");
  DefineConstIntCVar(e_GsmDepthBoundsDebug, 0, VF_NULL, 
    "Debug GSM bounds regions calculation");
  DefineConstIntCVar(e_GsmStats, 0, VF_CHEAT, 
    "Show GSM statistics 0=off, 1=enable debug to the screens");
  REGISTER_CVAR(e_GsmViewSpace, 0, VF_NULL, 
    "0=world axis aligned GSM layout, 1=Rotate GSM frustums depending on view camera");
  REGISTER_CVAR(e_GsmCache, 0, VF_NULL,
    "Cache sun shadows maps over several frames 0=off, 1=on if MultiGPU is deactivated");
  REGISTER_CVAR(e_GsmCacheLodOffset, 3, VF_NULL, 
    "Makes first X GSM lods not cached");
  REGISTER_CVAR(e_GsmCacheLodOffsetExtended, 6, VF_NULL, 
    "How fast to update terrain GSM lod");
  REGISTER_CVAR(e_GsmRangeStepExtended, e_GsmRangeStepExtendedDefault, VF_NULL, 
    "gsm_range_step for last gsm lod containing terrain");
  DefineConstIntCVar(e_GsmScatterLodDist, 70, VF_NULL, 
    "Size of Scattering LOD GSM in meters");
  REGISTER_CVAR(e_RNTmpDataPoolMaxFrames, 16, VF_CHEAT, 
    "Cache RNTmpData at least for X framres");

  REGISTER_CVAR(e_Terrain, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Activates drawing of terrain ground");
  DefineConstIntCVar(e_TerrainDeformations, 0, VF_CHEAT,
    "Allows in-game terrain surface deformations");
  DefineConstIntCVar(e_AutoPrecacheCameraJumpDist, 16, VF_CHEAT, 
    "When not 0 - Force full pre-cache of textures, procedural vegetation and shaders\n"
    "if camera moved for more than X meters in one frame or on new cut scene start");
  DefineConstIntCVar(e_AutoPrecacheTerrainAndProcVeget, 0, VF_CHEAT,
    "Force auto pre-cache of terrain textures and procedural vegetation");
  DefineConstIntCVar(e_AutoPrecacheTexturesAndShaders, 0, VF_CHEAT, 
    "Force auto pre-cache of general textures and shaders");
  DefineConstIntCVar(e_AutoPrecacheCgf, 1, VF_CHEAT, 
    "Force auto pre-cache of CGF render meshes. 1=pre-cache all mehes around camera. 2=pre-cache only important ones (twice faster)");
  REGISTER_CVAR(e_AutoPrecacheCgfMaxTasks, 8, VF_NULL, 
    "Maximum number of parallel streaming tasks during pre-caching");
  DefineConstIntCVar(e_TerrainBBoxes, 0, VF_CHEAT, 
    "Show terrain nodes bboxes");
  REGISTER_CVAR(e_TerrainNormalMap, e_TerrainNormalMapDefault, VF_NULL, 
    "Use terrain normal map for base pass if available");
  DefineConstIntCVar(e_TerrainOcclusionCulling, 1, VF_CHEAT, 
    "heightmap occlusion culling with time coherency 0=off, 1=on");
  DefineConstFloatCVar(e_TerrainOcclusionCullingStepSizeDelta, VF_CHEAT, 
    "Step size scale on every next step (for version 1)");
  REGISTER_CVAR(e_TerrainOcclusionCullingMaxDist,	200.f, VF_NULL, 
    "Max length of ray (for version 1)");
  REGISTER_CVAR(e_StreamPredictionUpdateTimeSlice, 0.4f, VF_NULL, 
    "Maximum amount of time to spend for scene streaming priority update in milliseconds");
  REGISTER_CVAR(e_StreamAutoMipFactorSpeedThreshold, 0.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_StreamAutoMipFactorMin, 0.5f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_StreamAutoMipFactorMax, 1.0f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_StreamAutoMipFactorMaxDVD, 0.5f, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_TerrainOcclusionCullingVersion, 1, VF_CHEAT, 
    "0 - old, 1 - new");
  DefineConstIntCVar(e_TerrainOcclusionCullingDebug, 0, VF_CHEAT, 
    "Draw sphere on every terrain height sample");
  DefineConstIntCVar(e_TerrainOcclusionCullingMaxSteps, 50, VF_CHEAT, 
    "Max number of tests per ray (for version 0)");
  DefineConstIntCVar(e_TerrainOcclusionCullingStepSize, 4, VF_CHEAT, 
    "Initial size of single step (in heightmap units)");
  DefineConstIntCVar(e_TerrainTextureDebug, 0, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_TerrainTextureStreamingDebug, 0, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_TerrainTextureStreamingPoolItemsNum, 64, VF_REQUIRE_LEVEL_RELOAD, 
    "Specifies number of textures in terrain base texture streaming pool");
  DefineConstIntCVar(e_TerrainLog, 0, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_TerrainDrawThisSectorOnly, 0, VF_CHEAT, 
    "1 - render only sector where camera is and objects registered in sector 00\n"
    "2 - render only sector where camera is");
  DefineConstFloatCVar(e_TerrainOcclusionCullingPrecision, VF_CHEAT, 
    "Density of rays");
  DefineConstFloatCVar(e_TerrainOcclusionCullingPrecisionDistRatio, VF_CHEAT, 
    "Controls density of rays depending on distance to the object");
  REGISTER_CVAR(e_TerrainLodRatio, 1.f, VF_NULL, 
    "Set heightmap LOD");
  DefineConstFloatCVar(e_TerrainLodRatioHolesMin, VF_NULL, 
    "Rises LOD for distant terrain sectors with holes, prevents too strong distortions of holes on distance ");

  REGISTER_CVAR(e_OcclusionCullingViewDistRatio, 0.5f, VF_NULL, 
    "Skip per object occlusion test for very far objects - culling on tree level will handle it");

  DefineConstFloatCVar(e_TerrainTextureLodRatio, VF_NULL, 
    "Adjust terrain base texture resolution on distance");

  REGISTER_CVAR(e_Sun, 1, VF_CHEAT, 
    "Activates sun light source");
  REGISTER_CVAR(e_CoverageBuffer, 1, VF_NULL, 
    "Activates usage of software coverage buffer.\n"
    "1 - camera culling only\n"
    "2 - camera culling and light-to-object check");
  DefineConstIntCVar(e_CoverageBufferCullIndividualBrushesMaxNodeSize, 0, VF_CHEAT, 
    "128 - cull only nodes of scene tree and very big brushes\n"
    "0 - cull all brushes individually");
  DefineConstIntCVar(e_CoverageBufferTerrain, 0, VF_NULL, 
    "Activates usage of coverage buffer for terrain");
  DefineConstIntCVar(e_CoverageBufferTerrainLodShift, 2, VF_NULL, 
    "Controls tessellation of terrain mesh");
  /*  REGISTER_CVAR(e_CoverageBufferTerrainMaxDistance, 512.f, VF_NULL, 
  "Only near sectors are rasterized");
  REGISTER_CVAR(e_CoverageBufferTerrainElevationShift, 4.f, VF_NULL, 
  "Shift low lods down in order to avoid false occlusion");
  REGISTER_CVAR(e_CoverageBufferTerrainLodRatio, 4.f, VF_NULL, 
  "Terrain lod ratio for mesh rendered into cbuffer");
  */	REGISTER_CVAR(e_CoverageBufferVersion, 2, VF_NULL, 
  "1 Vladimir's, 2MichaelK's");
  DefineConstIntCVar(e_CoverageBufferDebug, 0, VF_CHEAT, 
    "Display content of main camera coverage buffer");
  DefineConstIntCVar(e_CoverageBufferDebugFreeze, 0, VF_CHEAT, 
    "Freezes view matrix/-frustum ");
  DefineConstIntCVar(e_CoverageBufferDrawOccluders, 0, VF_CHEAT, 
    "Debug draw of occluders for coverage buffer");
  DefineConstIntCVar(e_CoverageBufferTestMode, 2, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_CoverageBufferBias, 0.05f, VF_NULL, 
    "Coverage buffer z-biasing");
  REGISTER_CVAR(e_CoverageBufferAABBExpand, 0.007f, VF_NULL, 
    "expanding the AABB's of the objects to test to avoid z-fighting issues in the Coverage buffer");
  REGISTER_CVAR(e_CoverageBufferRotationSafeCheck, 0, VF_NULL, 
    "Coverage buffer safe checking for rotation 0=disabled 1=enabled 2=enabled for out of frustum object");
  DefineConstIntCVar(e_CoverageBufferLightsDebugSide, -1, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_CoverageBufferDebugDrawScale, 1, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_CoverageBufferResolution, 128, VF_NULL, 
    "Resolution of software coverage buffer");




  REGISTER_CVAR(e_CoverageBufferReproj, 0, VF_NULL, 
    "Use re-projection technique on CBuffer");
  REGISTER_CVAR(e_CoverageBufferAccurateOBBTest, 0, VF_NULL, 
    "Checking of OBB boxes instead of AABB or bounding rects");
  DefineConstIntCVar(e_CoverageBufferTolerance, 0, VF_NULL, 
    "amount of visible pixel that will still identify the object as covered");
  DefineConstIntCVar(e_CoverageBufferOccludersTestMinTrisNum, 0, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_CoverageBufferOccludersViewDistRatio, 1.0f, VF_CHEAT, 
    "Debug");
  DefineConstFloatCVar(e_CoverageBufferOccludersLodRatio, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_CoverageBufferTreeDebug, 0, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_CoverageBufferMaxAddRenderMeshTime, 2, VF_NULL, 
    "Max time for unlimited AddRenderMesh");
  REGISTER_CVAR(e_CullerThread, 1, VF_CHEAT, 
    "The hw thread number on XENON that the culler will run on, only read at startup");

  DefineConstIntCVar(e_DynamicLightsMaxCount, 512, VF_CHEAT, 
    "Sets maximum amount of dynamic light sources");

  DefineConstIntCVar(e_DynamicLights, 1, VF_CHEAT, 
    "Activates dynamic light sources");
  DefineConstIntCVar(e_DynamicLightsForceDeferred, 1, VF_CHEAT, 
    "Convert all lights to deferred (except sun)");
  REGISTER_CVAR(e_DynamicLightsFrameIdVisTest, 1, VF_NULL, 
    "Use based on last draw frame visibility test");
  DefineConstIntCVar(e_DynamicLightsConsistentSortOrder, 1, VF_NULL, 
    "Debug");

  DefineConstIntCVar(e_HwOcclusionCullingWater,	1, VF_NULL, 
    "Activates usage of HW occlusion test for ocean");
  REGISTER_CVAR(e_HwOcclusionCullingObjects,0, VF_CHEAT, 
    "Activates usage of HW occlusion test for objects");

  DefineConstIntCVar(e_Portals, 1, VF_CHEAT, 
    "Activates drawing of visareas content (indoors), values 2,3,4 used for debugging");
  DefineConstIntCVar(e_PortalsBigEntitiesFix, 1, VF_CHEAT, 
    "Enables special processing of big entities like vehicles intersecting portals");
  REGISTER_CVAR(e_DynamicLightsMaxEntityLights, 16, VF_NULL, 
    "Set maximum number of lights affecting object");
  DefineConstFloatCVar(e_MaxViewDistance, VF_CHEAT, 
    "Far clipping plane distance");
  REGISTER_CVAR(e_MaxViewDistSpecLerp, 1, VF_NULL, 
    "1 - use max view distance set by designer for very high spec\n0 - for very low spec\nValues between 0 and 1 - will lerp between high and low spec max view distances");
  DefineConstFloatCVar(e_MaxViewDistFullDistCamHeight, VF_CHEAT, 
    "Debug");
  DefineConstIntCVar(e_WaterVolumes, 2, VF_CHEAT, 
    "Activates drawing of water volumes");
  DefineConstIntCVar(e_WaterWaves, 0, VF_CHEAT, 
    "Activates drawing of water waves");
  DefineConstIntCVar(e_WaterWavesTessellationAmount,	5, VF_NULL, 
    "Sets water waves tessellation amount");  
  REGISTER_CVAR(e_WaterTessellationAmount, 10, VF_NULL, 
		"Set tessellation amount");  
	REGISTER_CVAR(e_WaterTessellationAmountX, 10, VF_NULL, 
		"Set tessellation on x axis - 0 means not used");  	
	REGISTER_CVAR(e_WaterTessellationAmountY, 10, VF_NULL, 
		"Set tessellation on y axis - 0 means not used");  	
  REGISTER_CVAR(e_WaterTessellationSwathWidth, 12, VF_NULL, 
    "Set the swath width for the boustrophedonic mesh stripping"); 
  DefineConstIntCVar(e_BBoxes, 0, VF_CHEAT, 
    "Activates drawing of bounding boxes");

  DefineConstIntCVar(e_StreamSaveStartupResultsIntoXML, 0, VF_NULL, 
    "Save basic information about streaming performance on level start into XML");
  REGISTER_CVAR(e_StreamCgfPoolSize, 24, VF_NULL, 
    "Render mesh cache size in MB");
  REGISTER_CVAR(e_SQTestBegin, 0, VF_NULL, 
    "If not zero - start streaming latency unit test");
  REGISTER_CVAR(e_SQTestCount, 0, VF_NULL, 
    "If not zero - restart test X times");
  REGISTER_CVAR(e_SQTestExitOnFinish, 0, VF_NULL, 
    "If not zero - shutdown when finished testing");
  REGISTER_CVAR(e_SQTestDistance, 80, VF_NULL, 
    "Distance to travel");
  REGISTER_CVAR(e_SQTestMip, 1, VF_NULL, 
    "Mip to wait during test");
  REGISTER_CVAR(e_SQTestMoveSpeed, 10, VF_NULL, 
    "Camera speed during test (meters/sec)");

  // Small temp pool size for consoles, editor and pc have much larger capabilities




  DefineConstIntCVar(e_3dEngineTempPoolSize, 1024, VF_NULL, 
    "pool size for temporary allocations in kb, requires app restart");


  DefineConstIntCVar(e_3dEngineLogAlways, 0, VF_NULL, 
    "Set maximum verbosity to 3dengine.dll log messages");

  DefineConstIntCVar(e_CoverCgfDebug, 0, VF_NULL, "Shows the cover setups on cfg files");

  REGISTER_CVAR(e_StreamCgfMaxTasksInProgress, 32, VF_CHEAT,
    "Maximum number of files simultaneously requested from streaming system");
	REGISTER_CVAR(e_StreamPredictionMaxVisAreaRecursion, 9, VF_CHEAT,
		"Maximum number visareas and portals to traverse.");
	REGISTER_CVAR(e_StreamPredictionTexelDensity, 1, VF_CHEAT,
		"Use mesh texture mapping density info for textures streaming");
	REGISTER_CVAR(e_StreamPredictionAlwaysIncludeOutside, 0, VF_CHEAT,
		"Always include outside octrees in streaming"); 
  DefineConstFloatCVar(e_StreamCgfFastUpdateMaxDistance, VF_CHEAT, 
    "Update streaming priorities for near objects every second frame");
  DefineConstFloatCVar(e_StreamPredictionMinFarZoneDistance, VF_CHEAT, 
    "Debug");
  DefineConstFloatCVar(e_StreamPredictionMinReportDistance, VF_CHEAT, 
    "Debug");
  REGISTER_CVAR(e_StreamCgf, 1, VF_REQUIRE_APP_RESTART, 
    "Enable streaming of static render meshes");
  DefineConstIntCVar(e_StreamCgfDebug, 0, VF_NULL, 
    "Draw helpers and other debug information about CGF streaming\n"
    " 1: Draw color coded boxes for objects taking more than e_StreamCgfDebugMinObjSize,\n"
    "    also shows are the LOD's stored in single CGF or were split into several CGF's\n"
    " 2: Trace into console every loading and unloading operation\n"
    " 3: Print list of currently active objects taking more than e_StreamCgfDebugMinObjSize KB");
  DefineConstIntCVar(e_StreamCgfDebugMinObjSize, 100, VF_CHEAT, 
    "Threshold for objects debugging in KB");
  DefineConstIntCVar(e_StreamCgfDebugHeatMap, 0, VF_CHEAT, 
    "Generate and show mesh streaming heat map\n"
    " 1: Generate heat map for entire level\n"
    " 2: Show last heat map");  
  DefineConstFloatCVar(e_StreamPredictionDistanceFar, VF_CHEAT, 
    "Prediction distance for streaming, affects far objects");
  DefineConstFloatCVar(e_StreamPredictionDistanceNear, VF_CHEAT, 
    "Prediction distance for streaming, affets LOD of objects");
  DefineConstFloatCVar(e_StreamCgfVisObjPriority, VF_CHEAT, 
    "Priority boost for visible objects\n"
    "0 - visible objects has no priority over invisible objects, camera direction does not affect streaming\n"
    "1 - visible objects has highest priority, in case of trashing will produce even more trashing");

  DefineConstFloatCVar(e_StreamCgfGridUpdateDistance, VF_CHEAT, 
    "Update streaming priorities when camera moves more than this value");

  DefineConstFloatCVar(e_StreamPredictionAhead, VF_CHEAT, 
    "Use preducted camera position for streaming priority updates");

  DefineConstFloatCVar(e_StreamPredictionAheadDebug, VF_CHEAT, 
    "Draw ball at predicted position");

	DefineConstFloatCVar(e_DissolveDistMax, VF_CHEAT, 
		"At most how near to object MVD dissolve effect triggers (10% of MVD, clamped to this)");

	DefineConstFloatCVar(e_DissolveDistMin, VF_CHEAT, 
		"At least how near to object MVD dissolve effect triggers (10% of MVD, clamped to this)");

	DefineConstFloatCVar(e_DissolveDistband, VF_CHEAT, 
		"Over how many metres transition takes place");

  DefineConstIntCVar(e_StreamCgfUpdatePerNodeDistance, 1, VF_CHEAT, 
    "Use node distance as entity distance for far nodex ");

  DefineConstIntCVar(e_ScissorDebug, 0, VF_CHEAT, 
    "Debug");

#ifdef SUPPORT_LM
  REGISTER_CVAR(e_ram_maps, 1,VF_REQUIRE_LEVEL_RELOAD, 
    "Use RAM (real-time ambient maps) on brushes");
  REGISTER_CVAR(e_ram_DumpDXF, 0, VF_CHEAT, 
    "Dump DXF files of the UV-set of ram objects/brushes to visualize overlapping UVs");
#endif // SUPPORT_LM

  REGISTER_CVAR(e_Brushes, 1, VF_CHEAT | VF_CHEAT_ALWAYS_CHECK, 
    "Draw brushes");

  //  REGISTER_CVAR(e_SceneMerging, 0, VF_CHEAT, 
  //	"Merge brushes on level loading");
  //  REGISTER_CVAR(e_SceneMergingViewDistRatio, 3.f, VF_CHEAT, 
  //  "Controls size of rendered nodes depends from distance");
  //  REGISTER_CVAR(e_SceneMergingMinNodeSize, 16.f, VF_CHEAT, 
  //  "Min size of merge area (smallest areas are used near camera)");
  //  REGISTER_CVAR(e_SceneMergingMaxTrisPerInputChunk, 100, VF_CHEAT, 
  //  "Merge only chunks containing less than X triangles");
  /*	REGISTER_CVAR(e_scene_merging_compact_vertices, 1, VF_NULL, 
  "Minimize number of vertices in decals and merged brushes");
  REGISTER_CVAR(e_scene_merging_show_onlymerged, 0, VF_CHEAT, 
  "Show only merged brushes");
  REGISTER_CVAR(e_scene_merging_max_tris_in_chunk, 64, VF_NULL, 
  "Only objects having less than X triangles per chunk will me merged");
  REGISTER_CVAR(e_scene_merging_max_time_ms, 5, VF_NULL, 
  "Spend only X ms per frame on merging");
  REGISTER_CVAR(e_scene_merging_min_merge_distance, 0, VF_NULL, 
  "Don't merge nodes closer than X");*/

  REGISTER_CVAR(e_OnDemandPhysics, gEnv->IsEditor() ? 0:1, VF_NULL, 
    "Turns on on-demand vegetation physicalization");
  REGISTER_CVAR(e_OnDemandMaxSize, 20.0f, VF_NULL, 
    "Specifies the maximum size of vegetation objects that are physicalized on-demand");
  DefineConstIntCVar(e_Sleep, 0, VF_CHEAT, 
    "Sleep X in C3DEngine::Draw");
  REGISTER_CVAR(e_ObjectLayersActivation, (m_bEditor ? 0 : 1), VF_CHEAT, "Allow game to activate/deactivate object layers");
  DefineConstIntCVar(e_ObjectLayersActivationPhysics, 2, VF_CHEAT, 
    "Allow game to create/free physics of objects: 0: Disable; 1: All; 2: Water only.");
  DefineConstIntCVar(e_Objects, 1, VF_CHEAT, 
    "Render or not all objects");
  DefineConstIntCVar(e_Render, 1, VF_CHEAT, 
    "Enable engine rendering");
  DefineConstIntCVar(e_ObjectsTreeBBoxes, 0, VF_CHEAT, 
    "Debug draw of object tree bboxes");
  /*  REGISTER_CVAR(e_obj_tree_min_node_size, 0, VF_CHEAT, 
  "Debug draw of object tree bboxes");
  REGISTER_CVAR(e_obj_tree_max_node_size, 0, VF_CHEAT, 
  "Debug draw of object tree bboxes");*/
  DefineConstIntCVar(e_MtTest, 0, VF_CHEAT, 
    "MT Debug");
  REGISTER_CVAR(e_StatObjBufferRenderTasks, 0, VF_NULL, 
    "1 - occlusion test on render node level, 2 - occlusion test on render mesh level");
	REGISTER_CVAR(e_StatObjTessellationMaxEdgeLenght, 1.75f, VF_CHEAT, 
		"Split edges longer than X meters");
	REGISTER_CVAR(e_StatObjTessellationMode, 1, VF_CHEAT, 
		"Set they way pre-tessellated version of meshes is created: 0 = no pre-tessellation, 1 = load from disk, 2 = generate from normal mesh on loading");
  DefineConstIntCVar(e_StatObjTestOBB, 0, VF_CHEAT, 
    "Use additinal OBB check for culling");
  DefineConstIntCVar(e_ObjStats, 0, VF_CHEAT, 
    "Show instances count");
  DefineConstIntCVar(e_ObjFastRegister, 1, VF_CHEAT, 
    "Debug");

  DefineConstIntCVar(e_OcclusionLazyHideFrames, 0, VF_CHEAT, 
    "Makes less occluson tests, but it takes more frames to detect invisible objects");
  DefineConstIntCVar(e_OcclusionVolumes, e_OcclusionVolumesDefault, VF_CHEAT, 
    "Enable occlusion volumes(antiportals)");
  DefineConstFloatCVar(e_OcclusionVolumesViewDistRatio, VF_NULL, 
    "Controls how far occlusion volumes starts to occlude objects");

	DefineConstIntCVar(e_PrecacheLevel, 0, VF_NULL, 
		"Pre-render objects right after level loading");
	REGISTER_CVAR(e_Dissolve, 1, VF_NULL, 
		"Objects alphatest_noise_fading out on distance and between lods");
  DefineConstIntCVar(e_Lods, 1, VF_NULL, 
    "Load and use LOD models for static geometry");
  DefineConstIntCVar(e_LodsForceUse, 1, VF_NULL,
    "Force using LODs even if triangle count do not suit");  

  DefineConstIntCVar(e_Voxel, 1, VF_NULL, 
    "Render voxels");
  REGISTER_CVAR(e_VoxTerTexRangeScale, 1.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_SQTestDelay, 5.f, VF_NULL, 
    "Time to stabilize the system before camera movements");
  DefineConstIntCVar(e_VoxTerVegetationEx, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerPaintSleep, 10, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerPlanarProjection, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerIntegrateBoxes, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerMemWarning, 10, VF_NULL, 
    "Show message box when allocations reach X GB");
	REGISTER_CVAR(e_VoxScanScene, 0, VF_NULL, 
		"Debug");
  DefineConstIntCVar(e_VoxTerTexFormat, eTF_DXT1, VF_NULL, 
    "Mega-texture format: 22=eTF_DXT1, 24=eTF_DXT5, 7=eTF_A4R4G4B4, 8=eTF_R5G6B5");
  DefineConstIntCVar(e_VoxTerMemoryUsageDebug, 0, VF_NULL, 
    "Show only segments where mesh and textures memory usage is higher than X kb");
  DefineConstIntCVar(e_VoxTerDiskUsageDebug, 0, VF_NULL, 
    "Show only segments where disk usage is higher than X kb");
  DefineConstIntCVar(e_VoxTerTexUsageDebug, 0, VF_NULL, 
    "Show only segments where texture memory usage is higher than X kb");
  DefineConstIntCVar(e_VoxTerMeshUsageDebug, 0, VF_NULL, 
    "Show only segments where mesh memory usage is higher than X kb");
  REGISTER_CVAR(e_VoxTerTexPoolSizeForEditor, 128, VF_NULL, 
    "Maximum amount of re-mesh textures cached in memory (in MB)");
  DefineConstIntCVar(e_VoxTerBorderLodPlus, 2, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerMaxMeshBuildDepth, 5, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerMaxMeshBuildDepthLimit, 5, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerDebug, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerRoadsCheck, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerShapeCheck, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerRoadsCullDist, 4.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerThreads, max(1,GetSystem()->GetLogicalCPUCount()-1), VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerDebugBuildLeafs, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerOptimizeLods, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugAreaSizeMax, 128, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugAreaSizeRatio, 160, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugLodRatio, 35.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugX, 0.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugY, 0.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerDebugNodesGenDepth, 3, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerAddBrushes, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerRelaxation, 0, VF_NULL, 
    "Use X vertex relaxation passes during voxel terrain mesh generation");
  REGISTER_CVAR(e_VoxTerMeshSize, 2.f, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerTraceMessages, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTer, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerExportObjects, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerActivateAll, 0, VF_NULL, 
    "Actuate all terrain meshes and textures available marked as needed for game play");
  DefineConstIntCVar(e_VoxTerHeightmapEditing, 0, VF_NULL | VF_REQUIRE_LEVEL_RELOAD, 
    "Debug");
  DefineConstIntCVar(e_VoxTerHeightmapEditingCustomLayerInfo, 0, VF_NULL | VF_REQUIRE_LEVEL_RELOAD, 
    "Debug");
  DefineConstIntCVar(e_VoxTerShadows, 1, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerLog, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerOnTheFlyIntegration, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerIntegrateVegetations, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerInGameTextureStreaming, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerUpdateTextures, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerAsyncPhysicalization, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerTexDebug, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerHideIntegrated, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerTexBuildOnCPU, 0, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerTexBuildsPerFrame, 256, VF_NULL, 
    "Debug"); 
  DefineConstIntCVar(e_VoxTerMaxMeshLods, 9, VF_NULL, 
    "Debug"); 
  REGISTER_CVAR(e_VoxTerMaxMeshesInMem, 2000, VF_NULL, 
    "Debug"); 
  REGISTER_CVAR(e_VoxTerTexTiling, 1.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerTexResInternal, 256, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerTexResFinal, 256, VF_NULL, 
    "Debug");
	REGISTER_CVAR(e_VoxTerMeshSimplify, 1, VF_NULL, 
		"Debug");
  DefineConstIntCVar(e_VoxTerTexResBumpDownscale, 1, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerTexResExportDownscale, 1, VF_NULL, 
    "values 1 or 2 will downscale textures during exporting by factor of 2 or 4");
  DefineConstIntCVar(e_VoxTerTexRebuildEveryFrame, 0, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxTerMixMask, 0, VF_NULL, 
    "Store blend info, base color and normals in textures");
  DefineConstIntCVar(e_VoxTerOverlayBlend, 0, VF_NULL, 
    "Use overlay blending mode");
  REGISTER_CVAR(e_VoxTerViewDistRatio, 0.5f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerViewDistRatioPrediction, 1.f, VF_NULL, 
    "Debug");
  REGISTER_CVAR(e_VoxTerViewDistRatioMeshActivate, 0.5f, VF_NULL, 
    "Debug");
  DefineConstIntCVar(e_VoxelGenerate, 0, VF_NULL, 
    "Regenerate voxel world");
  DefineConstIntCVar(e_VoxelDebug, 0, VF_NULL, 
    "Draw voxel debug info");
  DefineConstIntCVar(e_VoxelAoRadius, 6, VF_NULL, 
    "Ambient occlusion test range in units");
  DefineConstIntCVar(e_VoxelAoScale, 8, VF_NULL, 
    "Ambient occlusion amount");
  DefineConstIntCVar(e_VoxelLodsNum, 2, VF_NULL, 
    "Generate LODs for voxels");

  REGISTER_CVAR(e_VoxelUpdatePhysics, 1, VF_NULL, 
    "Physicalize geometry");

  REGISTER_CVAR(e_ProcVegetation, 1, VF_NULL, 
    "Show procedurally distributed vegetation");
  DefineConstIntCVar(e_ProcVegetationMaxViewDistance, 128, VF_NULL, 
    "Maximum distance where procedural objects may be spawn");
  REGISTER_CVAR(e_ProcVegetationMaxSectorsInCache, 16, VF_NULL, 
    "Maximum number of 64x64 meter sectors cached in memory");
  REGISTER_CVAR(e_ProcVegetationMaxObjectsInChunk, 512, VF_NULL, 
    "Maximum number of instances per chunk");

  DefineConstIntCVar(e_Recursion, 1, VF_NULL, 
    "If 0 - will skip recursive render calls like render into texture");
  DefineConstIntCVar(e_RecursionOcclusionCulling,0, VF_NULL, 
    "If 0 - will disable occlusion tests for recursive render calls like render into texture");
  DefineConstFloatCVar(e_RecursionViewDistRatio, VF_NULL, 
    "Set all view distances shorter by factor of X");

  REGISTER_CVAR(e_Clouds, 0, VF_NULL, 
    "Enable clouds rendering");

  REGISTER_CVAR(e_SkyUpdateRate, 0.12f, VF_NULL, 
    "Percentage of a full dynamic sky update calculated per frame (0..100].");	
  DefineConstIntCVar(e_SkyQuality, 1, VF_NULL, 
    "Quality of dynamic sky: 1 (very high), 2 (high).");
  DefineConstIntCVar(e_SkyType, 1, VF_NULL, 
    "Type of sky used: 0 (static), 1 (dynamic).");

  DefineConstIntCVar(e_DisplayMemoryUsageIcon, e_DisplayMemoryUsageIconDefault,VF_NULL,
    "Turns On/Off the memory usage icon rendering: 1 on, 0 off.");

  REGISTER_CVAR(e_LodRatio, 6.0f, VF_NULL, 
    "LOD distance ratio for objects");
  DefineConstFloatCVar(e_LodCompMaxSize, VF_NULL, 
    "Affects LOD selection for big objects, small number will switch more objects into lower LOD");
  REGISTER_CVAR(e_ViewDistRatio, 60.0f, VF_NULL, 
    "View distance ratio for objects");
  DefineConstFloatCVar(e_ViewDistCompMaxSize, VF_NULL, 
    "Affects max view distance for big objects, small number will render less objects");
  DefineConstFloatCVar(e_ViewDistRatioPortals, VF_NULL, 
    "View distance ratio for portals");
  REGISTER_CVAR(e_ViewDistRatioDetail, 30.0f, VF_NULL, 
    "View distance ratio for detail objects");
  REGISTER_CVAR(e_ViewDistRatioVegetation, 30.0f, VF_NULL, 
    "View distance ratio for vegetation");
  REGISTER_CVAR(e_ViewDistRatioLights, e_ViewDistRatioLightsDefault, VF_NULL, 
    "View distance ratio for light sources");
  REGISTER_CVAR(e_ViewDistRatioCustom, 60.0f, VF_NULL, 
    "View distance ratio for special marked objects (Players,AI,Vehicles)");
  REGISTER_CVAR(e_ViewDistMin, 0.0f, VF_NULL, 
    "Min distance on what far objects will be culled out");
  REGISTER_CVAR(e_LodMin, 0, VF_NULL, 
    "Min LOD for objects");
  REGISTER_CVAR(e_CharLodMin, 0, VF_NULL, 
    "Min LOD for character objects");
  REGISTER_CVAR(e_LodMax, 6, VF_CHEAT, 
    "Max LOD for objects");
  DefineConstIntCVar(e_LodMinTtris, 300, VF_CHEAT, 
    "LODs with less triangles will not be used");
  REGISTER_CVAR(e_TerrainAo, 1, VF_NULL, 
    "Activate deferred terrain ambient occlusion");
  DefineConstIntCVar(e_DebugLights, 0, VF_CHEAT, 
    "Use different colors for objects affected by different number of lights\n black:0, blue:1, green:2, red:3 or more, blinking yellow: more then the maximum enabled");
  REGISTER_CVAR(e_PhysMinCellSize, 2, VF_NULL, 
    "Min size of cell in physical entity grid");
  REGISTER_CVAR(e_PhysProxyTriLimit, 0, VF_NULL, 
    "Maximum allowed triangle count for phys proxies");
  DefineConstIntCVar(e_PhysFoliage, 2, VF_NULL, 
    "Enables physicalized foliage\n"
    "1 - only for dynamic objects\n"
    "2 - for static and dynamic)");
  DefineConstFloatCVar(e_FoliageStiffness, VF_NULL, 
    "Stiffness of the spongy obstruct geometry");
  DefineConstFloatCVar(e_FoliageBranchesStiffness, VF_NULL, 
    "Stiffness of branch ropes");
  DefineConstFloatCVar(e_FoliageBranchesDamping, VF_NULL, 
    "Damping of branch ropes");
  DefineConstFloatCVar(e_FoliageBrokenBranchesDamping, VF_NULL, 
    "Damping of branch ropes of broken vegetation");
  REGISTER_CVAR(e_FoliageBranchesTimeout, 4.f, VF_NULL, 
    "Maximum lifetime of branch ropes (if there are no collisions)");
  REGISTER_CVAR(e_FoliageWindActivationDist,	0,  VF_NULL, 
    "If the wind is sufficiently strong, visible foliage in this view dist will be forcefully activated");

  DefineConstIntCVar(e_DeformableObjects, e_DeformableObjectsDefault, VF_NULL, 
    "Enable / Disable morph based deformable objects");

  REGISTER_CVAR(e_CullVegActivation, 200, VF_NULL, 
    "Vegetation activation distance limit; 0 disables visibility-based culling (= unconditional activation)");

	REGISTER_CVAR(e_PhysOceanCell, e_PhysOceanCellDefault, VF_NULL, 
		"Cell size for ocean approximation in physics, 0 assumes flat plane");

  DefineConstFloatCVar(e_JointStrengthScale, VF_NULL, 
    "Scales the strength of prebroken objects\' joints (for tweaking)");

  DefineConstFloatCVar(e_VolObjShadowStrength, VF_NULL, 
    "Self shadow intensity of volume objects [0..1].");

  DefineConstIntCVar(e_ScreenShot, 0, VF_NULL, 
    "Make screenshot combined up of multiple rendered frames\n"
    "(negative values for multiple frames, positive for a a single frame)\n"
    " 1 highres\n"
    " 2 360 degree panorama\n"
    " 3 Map top-down view\n"
    "\n"
    "see:\n"
    "  e_ScreenShotWidth, e_ScreenShotHeight, e_ScreenShotQuality, e_ScreenShotMapCenterX,\n"
    "  e_ScreenShotMapCenterY, e_ScreenShotMapSize, e_ScreenShotMinSlices, e_ScreenShotDebug");

  REGISTER_CVAR(e_ScreenShotWidth, 2000, VF_NULL, 
    "used for all type highres screenshots made by e_ScreenShot to define the\n"
    "width of the destination image, 2000 default");
  REGISTER_CVAR(e_ScreenShotHeight, 1500, VF_NULL, 
    "used for all type highres screenshots made by e_ScreenShot to define the\n"
    "height of the destination image, 1500 default");
  REGISTER_CVAR(e_ScreenShotQuality, 30, VF_NULL, 
    "used for all type highres screenshots made by e_ScreenShot to define the quality\n"
    "0=fast, 10 .. 30 .. 100 = extra border in percent (soften seams), negative value to debug");
  REGISTER_CVAR(e_ScreenShotMinSlices, 4, VF_NULL, 
    "used for all type highres screenshots made by e_ScreenShot to define the amount\n"
    "of sub-screenshots for the width and height to generate the image,\n the min count\n"
    "will be automatically raised if not sufficient (per screenshot-based)");
  REGISTER_CVAR(e_ScreenShotMapCenterX, 0.0f, VF_NULL, 
    "param for the centerX position of the camera, see e_ScreenShotMap\n"
    "defines the x position of the top left corner of the screenshot-area on the terrain,\n"
    "0.0 - 1.0 (0.0 is default)");
  REGISTER_CVAR(e_ScreenShotMapCenterY, 0.0f, VF_NULL, 
    "param for the centerX position of the camera, see e_ScreenShotMap\n"
    "defines the y position of the top left corner of the screenshot-area on the terrain,\n"
    "0.0 - 1.0 (0.0 is default)");
  REGISTER_CVAR(e_ScreenShotMapSizeX, 1024.f, VF_NULL, 
    "param for the size in worldunits of area to make map screenshot, see e_ScreenShotMap\n"
    "defines the x position of the bottom right corner of the screenshot-area on the terrain,\n"
    "0.0 - 1.0 (1.0 is default)");
  REGISTER_CVAR(e_ScreenShotMapSizeY, 1024.f, VF_NULL, 
    "param for the size in worldunits of area to make map screenshot, see e_ScreenShotMap\n"
    "defines the x position of the bottom right corner of the screenshot-area on the terrain,\n"
    "0.0 - 1.0 (1.0 is default)");
  REGISTER_CVAR(e_ScreenShotMapCamHeight, 4000.f, VF_NULL, 
    "param for top-down-view screenshot creation, defining the camera height for screenshots,\n"
    "see e_ScreenShotMap defines the y position of the bottom right corner of the\n"
    "screenshot-area on the terrain,\n"
    "0.0 - 1.0 (1.0 is default)");
  REGISTER_CVAR(e_ScreenShotMapOrientation, 0, VF_NULL, 
    "param for rotating the orientation through 90 degrees so the screen shot width is along the X axis\n"
    "see e_ScreenShotMap\n"
    "0 - 1 (0 is default)");
  REGISTER_CVAR(e_ScreenShotDebug, 0, VF_NULL, 
    "0 off\n1 show stitching borders\n2 show overlapping areas");

  DefineConstIntCVar(e_Ropes, 1, VF_CHEAT, 
    "Turn Rendering of Ropes on/off");

  DefineConstIntCVar(e_StatObjValidate, e_StatObjValidateDefault, VF_NULL, 
    "Enable CGF mesh validation during loading");

  DefineConstIntCVar(e_StatObjPreload, 1, VF_NULL, 
    "Load level CGF's in efficient way");

  DefineConstIntCVar(e_PreloadMaterials, 1, VF_NULL,
    "Preload level materials from level cache pak and resources list");
  DefineConstIntCVar(e_PreloadDecals, 1, VF_NULL,
    "Preload all materials for decals");

  DefineConstIntCVar(e_StatObjMerge, 1, VF_NULL, 
    "Enable CGF sub-objects meshes merging");
  DefineConstIntCVar(e_StatObjMergeUseThread, 1, VF_NULL, 
    "Use a thread to perform sub-objects meshes merging");	
  DefineConstIntCVar(e_StatObjMergeMaxTrisPerDrawCall, 500, VF_NULL, 
    "Skip merging of meshes already having acceptable number of triangles per draw call");

  DefineConstIntCVar(e_DefaultMaterial, 0, VF_CHEAT,
    "use gray illumination as default");

  REGISTER_CVAR(e_ObjQuality, 0, VF_NULL, 
    "Object detail quality");
  REGISTER_CVAR(e_ParticlesQuality, 0, VF_NULL, 
    "Particles detail quality");




		#define PARTICLE_POOL_KB 0


  REGISTER_CVAR(e_ParticlesPoolSize, PARTICLE_POOL_KB, VF_CHEAT|VF_CHEAT_NOCHECK|VF_REQUIRE_LEVEL_RELOAD, 
    "Particles pool memory size in KB; 0 for unlimited");
  REGISTER_CVAR(e_ParticlesEmitterPoolSize, 0, VF_INVISIBLE, "");		// Obsolete, is summed to e_ParticlesPoolSize

  DefineConstIntCVar(e_ParticlesLights, 1, VF_NULL, 
    "Allows to have light source attached to every particle\n"
    "0 = Off\n"
    "1 = Deferred lights\n");

  DefineConstFloatCVar(e_ParticlesLightsViewDistRatio, VF_NULL, 
    "Set particles lights view distance ratio");

  REGISTER_CVAR(e_ParticlesUseLevelSpecificLibs, 0, VF_NULL, 
    "Allows searching for level-specific version of effects files\n"
    "0 = Off\n"
    "1 = Enabled\n");

  REGISTER_CVAR(e_ParticlesAnimBlend, 1, VF_NULL, 
    "Blend between animated texture frames\n"
    "Usage: e_ParticlesAnimBlend [0/1/2]\n"
    "0 = Disable\n"
    "1 = Allow\n"
    "2 = Force\n");

  REGISTER_CVAR(e_ParticlesGI, 1, VF_NULL, 
    "Apply global illumination to appropriate particle effects\n"
    "Usage: e_ParticlesGI [0/1/2]\n"
    "0 = Disable\n"
    "1 = Allow\n"
    "2 = Force\n");

	REGISTER_CVAR(e_ParticlesDiffCM, 1, VF_NULL, 
		"Apply diffuse cubemaps to appropriate particle effects\n"
		"Usage: e_ParticlesDiffCM [0/1/2]\n"
    "0 = Disable\n"
    "1 = Allow\n"
    "2 = Force\n");

	REGISTER_CVAR(e_ParticlesSoftIntersect, 1, VF_NULL, 
		"Render particles with soft intersection\n"
		"Usage: e_ParticlesSoftIntersect [0/1/2]\n"
    "0 = Disable\n"
    "1 = Allow\n"
    "2 = Force\n");

	REGISTER_CVAR(e_ParticlesMotionBlur, 1, VF_NULL, 
		"Motion blur for particles\n"
		"Usage: e_ParticlesMotionBlur [0/1/2]\n"
		"0 = Off\n"
		"1 = On\n"
		"2 = Force");

	REGISTER_CVAR(e_ParticlesShadows, 1, VF_NULL, 
		"Shadows on particles\n"
		"Usage: e_ParticlesShadows [0/1/2]\n"
		"0 = Off\n"
		"1 = On\n"
		"2 = Force");

  e_ScreenShotFileFormat = REGISTER_STRING("e_ScreenShotFileFormat", "tga",  VF_NULL,
    CVARHELP("Set output image file format for hires screen shots. Can be JPG or TGA"));
  e_SQTestTextureName = REGISTER_STRING("e_SQTestTextureName", "strfrn_advrt_boards_screen",  VF_NULL,
    CVARHELP("Reference texture name for streaming latency test"));
  e_StreamCgfDebugFilter = REGISTER_STRING("e_StreamCgfDebugFilter", "",  VF_NULL,
    CVARHELP("Show only items containig specified text"));

  e_CameraGoto = REGISTER_STRING("e_CameraGoto", "0",  VF_CHEAT,
    CVARHELP("Move cameras to a certain pos/angle"));

	REGISTER_CVAR(e_TimeOfDay,0.0f,VF_CHEAT | VF_CHEAT_NOCHECK,
		"Current Time of Day")->SetOnChangeCallback(OnTimeOfDayVarChange);
	REGISTER_CVAR(e_TimeOfDaySpeed,0.0f,VF_CHEAT | VF_CHEAT_NOCHECK,
		"Time of Day change speed")->SetOnChangeCallback(OnTimeOfDaySpeedVarChange);
  DefineConstIntCVar(e_TimeOfDayDebug, 0, VF_NULL, 
    "Display time of day current values on screen");


  DefineConstFloatCVar(e_CameraRotationSpeed, VF_CHEAT, 
    "Rotate camera around Z axis for debugging");
  DefineConstIntCVar(e_CameraFreeze, 0, VF_CHEAT, 
    "Freeze 3dengine camera (good to debug object culling and LOD).\n"
    "The view frustum is drawn in write frame.\n"
    " 0 = off\n"
    " 1 = activated");

  DefineConstIntCVar(e_SplitScreenTest, 0, VF_CHEAT, 
    "Split screen into 2x2 views. Currently doesn't work with deferred shading, post-processing, SSAO and terrain AO");

  REGISTER_CVAR(e_GI, 0, VF_NULL, 
    "Enable/disable global illumination. Default: 1 - enabled" );
  DefineConstIntCVar(e_GISecondaryOcclusion, 0, VF_NULL, 
    "Enable/disable secondary occlusion for global illumination. Default: 0 - disabled" );
  DefineConstIntCVar(e_GIGlossyReflections, 0, VF_NULL, 
    "Enable/disable reflective mode for global illumination. Default: 0 - disabled" );
  REGISTER_CVAR(e_GINumCascades, 1, VF_NULL, 
    "Sets number of cascades for global illumination. Default: 1" );
  DefineConstFloatCVar(e_GICascadesRatio, VF_NULL, 
    "Sets slope of cascades for global illumination. Default: 2.f" );
	DefineConstIntCVar(e_GIRSMSize, CRELightPropagationVolume::espMaxInjectRSMSize, VF_NULL, 
		"Set the default reflective shadow map size.\n"
		"Default: 256 pixels for PC/128 for consoles, minimum: 64, maximum: 512" );
	REGISTER_CVAR(e_GIAmount, e_GIAmountDefault, VF_NULL, 
		"Multiplier for brightness of the global illumination. Default: 25.0 times brighter (temporary)" );
	DefineConstFloatCVar(e_GIMaxDistance, VF_NULL, 
		"Maximum distance of global illumination in meters.\n"
		"The less the distance the better the quality. Default: 50. Max: 150" );
#if !defined(XENON) && !defined(PS3)
	DefineConstIntCVar(e_GIIterations, 10, VF_NULL, 
		"Maximum number of propagation iterations global illumination\n"
		"The less number of propagation iterations the shorter the light propagation distance. Default: 6. Max: 32" );




#endif
	DefineConstFloatCVar(e_GIOffset, VF_NULL, 
		"Offset of GI in front of camera in percents[0;1]. Default: 0.4 Min: 0 Max: 1" );

	REGISTER_CVAR(e_GIPropagationAmp, e_GIPropagationAmpDefault, VF_NULL, 
		"Light amplification during each propagation iteration. Default: 3.3 Min: 1 Max: 5" );

	REGISTER_CVAR(e_RenderMeshCollisionTolerance, 0.3f, VF_NULL, 
		"Min distance between physics-proxy and rendermesh before collision is considered a hole");

	DefineConstFloatCVar(e_GIBlendRatio, VF_NULL, 
		"Ratio of overlapped region between nested cascades. 0.25 means 25% overlapping. Default: 0.25 Min: .1 Max: 2" );

	REGISTER_CVAR(e_GICache, 7, VF_NULL, 
    "Sparse temporal caching for RSM rendering. Measured in framed per generation. Default: 7 Min: 0 (disabled)" );

  REGISTER_CVAR(e_WorldSegmentationTest,0, VF_CHEAT, 
    "Debug only: simulates multi-segment behavior in the editor");

  DefineConstIntCVar(e_PrepareDeformableObjectsAtLoadTime,0, VF_CHEAT, 
    "Enable to Prepare deformable objects at load time instead on demand, prevents peaks but increases memory usage");

  DefineConstIntCVar(e_DeferredPhysicsEvents,1, VF_CHEAT, 
    "Enable to Perform some physics events deferred as a task/spu job");

  REGISTER_CVAR(e_levelStartupFrameNum,0, VF_NULL, 
    "Set to number of frames to capture for avg fps computation");

  REGISTER_CVAR(e_levelStartupFrameDelay,0, VF_NULL, 
    "Set to number of frames to wait after level load before beginning fps measuring");

  REGISTER_CVAR(e_CacheNearestCubePicking,1, VF_NULL, 
    "Enable caching nearest cube maps probe picking for alpha blended geometry");
  
	REGISTER_CVAR(e_UncompressedTerrainTexture, 0, VF_NULL,
		"Set to 1 to export the terrain texture tiles without DXT5 compression (use only when really necessary).");

	REGISTER_CVAR(e_MaxDrawCalls, 0, VF_CHEAT, 
		"Will not render CGFs past the given amount of drawcalls\n"
		"(<=0 off (default), >0 draw calls limit)");

	REGISTER_CVAR(e_CheckOctreeObjectsBoxSize, 1, VF_NULL, 
		"Check for crazy sized COctreeNode m_objectsBoxes\n"
		"  0 - do nothing\n"
		"  1 - CryWarning\n"
		"  2 - CryWarning and __debugbreak()");
}
